<{include file='customer/head.html'}>
<link rel="stylesheet" href="/static/js/plugins/layui/css/layui.css" media="all">
<style type="text/css">
	body .layui-rate{padding: 0;}
	body .layui-rate li{margin: 0;}
</style>
<body>
	<div class="akrPop">
		<form id="frm" action="" target="f" method="post" enctype="multipart/form-data">
			<ul class="ulForm">
				<li>
					<label class="form-label">名称：</label>
					<div class="form-input">
						<input name="name" value="" class="inputText">
					</div>
				</li>
				<li>
					<label class="form-label">星级：</label>
					<div class="form-input">
						<input type="hidden" name="star" value="">
						<div id="star"></div>
					</div>
				</li>
				<li>
					<label class="form-label">销售：</label>
					<div class="form-input">
						<select name="saleuid">
							<{foreach from=$saleuserlist item=vo}>
								<option value="<{$vo.id}>"><{$vo.displayname}></option>
							<{/foreach}>
						</select>
					</div>
				</li>
				<li>
					<label class="form-label">备注：</label>
					<div class="form-input">
						<textarea name="remark" value="" rows="5"></textarea>
					</div>
				</li>
				<li>
					<div class="form-input">
						<input type="button" onclick="add()" status="0" value="提交" class="akrBtn akrBtn-md blue">
					</div>
				</li>
			<ul>
		</form>
	</div>

<script src="/static/js/plugins/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript">
	layui.use(['rate'], function(){
		var rate = layui.rate;
		rate.render({
			elem: '#star'
			,value: 3
			,theme: '#FF8000' //自定义主题色
			,choose: function(value){
				$("input[name='star']") .val(value);
			}
		  });
	})
	var addstatus=true;
	function add(){
		var data = $("form").serialize();
		var href='../CustomerIndex/add';
		if(addstatus){
            addstatus = false;
            _ajaxs.post(href,data,function _return(hdata)<{literal}>{
                if(hdata.status){
                    _layer_admin.successMsg(hdata.message,function(){
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                        parent.location.reload();
                    });
                }else{
                    addstatus = true;
                    _layer_admin.successMsg(hdata.message);
                }
            }<{/literal}>)
        }
	}
</script>
</body>
</html>